<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>杨梅色彩美学代言</title>
        <script src="__INDEX__/js/mui.min.js"></script>
	<link rel="stylesheet" href="__INDEX__/css/mui.min.css">
    <link rel="stylesheet" href="__INDEX__/css/style.css" />
    <link rel="stylesheet" href="__INDEX__/css/mall.css" />
</head>
<body>
	<div class="mui-content cp_content" style="padding-bottom: 20px;">
	   {include file="public/top" /}
	    <div class="btn_gmhyk clearfix" style="padding-top: 0px;">
	    	<div onclick="buy(1)" style="width: 94%;margin-left:3%;"><img src="__INDEX__/images/m1.jpg"  style="pointer-events: none;"></div>
	    	<div  onclick="buy(2)" style="width: 94%;margin-left:3%;margin-top: 10px;"><img src="__INDEX__/images/m2.jpg" style="pointer-events: none;"></div>
	    </div>
	  	 {if isset($site)}{$site|html_entity_decode}
	    {else}
	    <img src="__INDEX__/images/b1.jpg?5=1" >
	    {/if}
	</div>
</body>
</html>
{include file="public/footer" /}
<script>
		function buy(type){
			var id="{$Think.session.user_info.id}";
			if(id==null||id==""||id==undefined){
				layer.msg('请您先注册！',{time:2*1000},function() {
					window.location.href="{:url('member/regist')}";
				})
			}
			var is_rz="{$user['is_rz']}";
			var is_qy="{$user['is_qy']}";
			if(is_qy==1){
				layer.msg("您已经是企业会员了!");
				return ;
			}else if(is_rz==1&&type==1){
				layer.msg("您已经是会员了,请升级为企业会员!");
				return ;
			}
			$.ajax({
			type:"post",
			data:{
				type:type
			},
			url:"/index/payment/mem_pay",
			success:function(data){
				data=JSON.parse(data);
				callpay(data);
			}
		});
	}
		//调用微信JS api 支付
		function jsApiCall(jsApiParameters) {
			WeixinJSBridge.invoke('getBrandWCPayRequest', jsApiParameters,
				function(res) {
					if(res.err_msg == "get_brand_wcpay_request:ok") {
						layer.msg("支付成功");
					} else {
						layer.msg("支付失败");
					}
					//window.location="/index/member";
				}
			);
		}

		function callpay(jsApiParameters) {
			if(typeof WeixinJSBridge == "undefined") {
				if(document.addEventListener) {
					document.addEventListener('WeixinJSBridgeReady', jsApiCall(jsApiParameters), false);
				} else if(document.attachEvent) {
					document.attachEvent('WeixinJSBridgeReady', jsApiCall(jsApiParameters));
					document.attachEvent('onWeixinJSBridgeReady', jsApiCall(jsApiParameters));
				}
			} else {
				jsApiCall(jsApiParameters);
			}
		}
</script>